package com.blb.demo3;

import com.blb.Computer;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * @author lvtian
 * @date 2022/12/22 15:33
 */
//组件的扫描
@ComponentScan(basePackages = "com.blb")
@Configuration
public class SpringConfig {
    public static void main(String[] args) {
        //创建基于注解的上下文
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);
        Computer computer = context.getBean(Computer.class);
        computer.start();
    }
}
